home *** CD-ROM | disk | FTP | other *** search
/ The X-Philes (2nd Revision) / The X-Philes Number 1 (1995).iso / xphiles / hp95 / freyja13.exe / lha / FGENLIB.H < prev    next >
C/C++ Source or Header  |  1992-03-22  |  4KB  |  184 lines

  1. /* FGENLIB.H -- Main General Header File
  2.  
  3.     Written July 1988 by Craig Finseth
  4. */
  5.  
  6.     /* operating system -- define only one */
  7.  
  8. /* #define VARARGS        1 */    /* supports varargs */
  9.  
  10. /* #define BERK43        1 */
  11. /* #define SUNOS4        1 */
  12. /* #define SUNOS3        1 */
  13. /* #define UNICOS        1 */
  14. /* #define UNIXV        1 */
  15. #define MSDOS        1
  16.  
  17. #if defined(SUNOS4)
  18. #define SUNOS3        1
  19. #endif
  20.  
  21. #if defined(SUNOS3)
  22. #define BERK43        1
  23. #endif
  24.  
  25. #if defined(UNICOS)
  26. #define UNIXV        1
  27. #endif
  28.  
  29. /* -------------------- General Includes -------------------- */
  30.  
  31. #if !defined(MSDOS)
  32. #include <sys/types.h>
  33. #include <sys/file.h>
  34. #include <time.h>
  35. time_t time();
  36. struct tm *localtime();
  37. #if defined(UNIXV)
  38. #include <fcntl.h>
  39. #include <malloc.h>
  40. #include <unistd.h>
  41. #endif
  42. #endif
  43. #include <ctype.h>
  44. #include <string.h>
  45. #include <stdio.h>
  46. #if defined(VARARGS)
  47. #if defined(__STDC__)
  48. #include <stdarg.h>
  49. #else
  50. #include <varargs.h>
  51. #endif
  52. #endif
  53.  
  54. #if defined(UNIXV)
  55. #define L_SET            0
  56. #endif
  57.  
  58. /* -------------------- Configuration Constants -------------------- */
  59.  
  60.     /* types */
  61.  
  62. #define FLAG        char
  63.  
  64.     /* constants */
  65.  
  66. #ifndef NULL
  67. #define NULL        ((void *) 0)
  68. #endif
  69.  
  70. #define TRUE        1
  71. #define FALSE        0
  72.  
  73. #if !defined(MSDOS)
  74. #define MAXINT        2147483647
  75. #define MININT        (-2147483648)
  76. #define MAXUNS        4294967295
  77. #endif
  78.  
  79. #define NUL        '\0'
  80. #define BEL        '\7'
  81. #define BS        '\10'
  82. #define TAB        '\11'
  83. #define LF        '\12'
  84. #define VT        '\13'
  85. #define FF        '\14'
  86. #define CR        '\15'
  87. #define SP        ' '
  88. #define DEL        '\177'
  89. #define NL        '\n'
  90. #define ESC        '\33'
  91.  
  92. #if defined(MSDOS)
  93. #define NEWLINE        "\r\n"
  94. #else
  95. #define NEWLINE        "\n"
  96. #endif
  97.  
  98. #if defined(MSDOS)
  99. #define BUFFSIZE    1024        /* good buffer size to use */
  100. #define FNAMEMAX    81        /* size of file name */
  101. #define TOKENMAX    257        /* size of a general token */
  102. #define INPMAX        256        /* size of user input buffer */
  103. #else
  104. #define BUFFSIZE    (24 * 1024)    /* good buffer size to use */
  105. #define FNAMEMAX    1025        /* size of file name */
  106. #define TOKENMAX    1025        /* size of a general token */
  107. #define INPMAX        256        /* size of user input buffer */
  108. #endif
  109.  
  110. /* -------------------- Routines -------------------- */
  111.  
  112.     /* LIB.C */
  113.  
  114. #if defined(MSDOS)
  115. #define close(fd)        PSystem(0x3E,0,0,fd)
  116. #define creat(name)        PSystem(0x3C,name,0)
  117. #define open(name,mode,perm)    PSystem(0x3D,name,0,0,mode)
  118. #define lseek(fd,dist,mode)    lseeka(fd,dist,mode)
  119. #define read(fd,buff,amt)    PSystem(0x3F,buff,amt,fd)
  120. #define rename(old,new)        PSystem(0x56,old,0,0,0,0,new)
  121. #define tell(fd)        tellc(fd)
  122. #define unlink(name)        PSystem(0x41,name)
  123. #define write(fd,buff,amt)    PSystem(0x40,buff,amt,fd)
  124. #endif
  125.  
  126. #if defined(UNIXV)
  127. #define memmove(d,s,l)    memcpy(d,s,l)    /* ANSI C compatibility */
  128. #endif
  129. #ifdef BERK43
  130. #define memmove(d,s,l)    bcopy(s,d,l)    /* ANSI C compatibility */
  131. #endif
  132. #define xstrncpy(d,s)        { strncpy((d),(s),sizeof(d)); (d)[sizeof(d)-1]=NUL; }
  133.  
  134. int max();            /* int a, int b */
  135. int min();            /* int a, int b */
  136. char *sindex();            /* char *str, char chr */
  137. FLAG SToN();            /* char *str, int *n, int base */
  138. FLAG strequ();            /* char *a, char *b */
  139. FLAG strnequ();            /* char *a, char *b, int len */
  140. FLAG xisalnum();        /* int c */
  141. FLAG xisalpha();        /* int c */
  142. FLAG xisdigit();        /* int c */
  143. FLAG xisgray();            /* char c */
  144. FLAG xislower();        /* int c */
  145. FLAG xisupper();        /* int c */
  146. void xstrcpy();            /* char *dest, char *src */
  147. int xtolower();            /* int c */
  148. int xtoupper();            /* int c */
  149.  
  150.     /* LIBASM.ASM */
  151.  
  152. #if defined(MSDOS)
  153. unsigned BlockAlloc(unsigned para);
  154. void BlockFree(unsigned para);
  155. void BlockGet(char *to, char huge *from, int len);
  156. void BlockPut(char huge *to, char *from, int len);
  157. void JFiniA(void);
  158. void JInitA(void);
  159. int JGetKeyA(void);
  160. int JIsKeyA(void);
  161. void JLightOff(void);
  162. void JLightOn(void);
  163. void JPushKeyA(int key);
  164. long lseeka(int fd, long dist, int mode);
  165. int PSystem(int AH, ...); /* int DX, int CX, int BX, int AL, int SI, int DI */
  166. int VidInit(void);
  167. void VidFini(void);
  168. void VidBell(void);
  169. void VidChar(char chr);
  170. void VidClear(int count);
  171. void VidCursor(int row, int col);
  172. void VidCurOff(void);
  173. void VidCurOn(void);
  174. #endif
  175.  
  176.     /* XPRINTF.C */
  177.  
  178. void xprintf();            /* char *fmt, ... */
  179. void xdprintf();        /* int fd, char *fmt, ... */
  180. void xeprintf();        /* char *fmt, ... */
  181. void xsprintf();        /* char *string, char *fmt, ... */
  182.  
  183. /* end of FGENLIB.H -- Main General Header File */
  184.